﻿// 设定左边妹子的高度
function makeHeight()
{
	var height=document.getElementById('common_div_right').scrollHeight;
	if (height > 768) 
	{
		document.getElementById('common_div_left').style.height=height;
	}
	else 
	{
		document.getElementById('common_div_left').style.height=768;
	}
}
// 向定时器传递函数
function _t(_f,_p1,_p2)
{
	return function(){_f(_p1,_p2);}
}
// 设定状态参数
default_h=81;
hiding=new Array();
slow=0.08;
// 展开DIV
function ShowContent(obj,speed)
{
	var _h=parseInt(obj.scrollHeight);
	var tmp=parseInt(obj.style.height);
	if(!speed)
	{
		speed=slow*_h;
	}
	if(!obj.style.height)
	{
		obj.style.height=default_h;
	}
	
	if(!hiding[obj.innerHTML])
	{
		if(tmp<_h)
		{
			obj.style.height=tmp+speed;
			tmp=obj.style.height;
			speed*=0.9;
			t=setTimeout(_t(ShowContent,obj,speed),1);
		}
		else
		{
			if(obj.scrollHeight>default_h)
			{
				obj.style.height=obj.scrollHeight;
			}
		}
	}
}
// 收起DIV
function HideContent(obj,speed)
{
	var _h=parseInt(obj.scrollHeight);
	if(!speed)
	{
		speed=slow*_h;
	}
	if(!tmp)
	{
		var tmp=parseInt(obj.style.height);
	}
	if(tmp>default_h)
	{
		obj.style.height=tmp-speed;
		tmp=obj.style.height;
		speed*=0.9;
		hiding[obj.innerHTML]=1;
		t=setTimeout(_t(HideContent,obj,speed),1);
	}
	else
	{
		obj.style.height=default_h;
		hiding[obj.innerHTML]=0;
	}
}


